View Javadoc
1 /* 2 * JPUI 3 * 4 * $RCSfile: JPUI.java,v $ 5 * $Revision: 1.3 $ 6 * $Date: 2004/01/04 18:51:04 $ 7 * $Source: /cvsroot/jpui/jpui/src/JPUI.java,v $ 8 * 9 * JPUI - Java Preferences User Interface 10 * Copyright (C) 2003 11 * 12 * This program is free software; you can redistribute it and/or modify it 13 * under the terms of the GNU General Public License as published by the Free 14 * Software Foundation; either version 2 of the License, or (at your option) 15 * any later version. 16 * 17 * This program is distributed in the hope that it will be useful, but WITHOUT 18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 20 * more details. 21 * 22 * You should have received a copy of the GNU General Public License along with 23 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 24 * Place, Suite 330, Boston, MA 02111-1307 USA 25 * 26 * Author: macksold@users.sourceforge.net 27 */ 28 29 import java.awt.BorderLayout; 30 import java.awt.Dimension; 31 import java.awt.event.WindowAdapter; 32 import java.awt.event.WindowEvent; 33 34 import javax.swing.JFrame; 35 import javax.swing.JPanel; 36 import javax.swing.JScrollPane; 37 import javax.swing.JSplitPane; 38 39 /*** 40 * The one and only main program class. 41 * 42 * Builds the model, the views, and lays out the GUI. 43 */ 44 public class JPUI { 45 // views 46 private MainView moMainView; 47 private TreeView moTreeView; 48 private EditNodeView moEditNodeView; 49 50 // gui parts 51 private static JFrame moFrame = null; 52 private static JPanel moContentPanel = null; 53 54 public JPUI() { 55 initialize(); 56 } 57 58 /*** 59 * Construct and put together the model, views, 60 * and UI components. 61 */ 62 private void initialize() { 63 // the views 64 moTreeView = new TreeView(); 65 moEditNodeView = new EditNodeView(); 66 moMainView = new MainView(moTreeView, moEditNodeView); 67 68 // 69 // the gui 70 // 71 72 // main frame 73 moFrame = new JFrame(Resources.getString("title_bar")); 74 moFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); 75 moFrame.addWindowListener(new WindowAdapter() { 76 public void windowClosing(WindowEvent oEv) { 77 System.exit(0); 78 } 79 }); 80 81 // menu 82 moFrame.setJMenuBar(moMainView.getMenuBar()); 83 84 // content panel and tool bar 85 moContentPanel = new JPanel(); 86 moContentPanel.setLayout(new BorderLayout()); 87 moContentPanel.setPreferredSize(new Dimension(600, 500)); 88 89 moFrame.setContentPane(moContentPanel); 90 91 // the main view 92 JScrollPane oTreePane = new JScrollPane(moTreeView.getPanel()); 93 JScrollPane oEditNodePane = new JScrollPane(moEditNodeView.getPanel()); 94 JSplitPane oSplitPane = 95 new JSplitPane( 96 JSplitPane.HORIZONTAL_SPLIT, 97 oTreePane, 98 oEditNodePane); 99 oSplitPane.setDividerLocation(200); 100 moContentPanel.add(oSplitPane, BorderLayout.CENTER); 101 } 102 103 /*** 104 * @return javax.swing.JPanel 105 */ 106 public static JPanel getContentPanel() { 107 return moContentPanel; 108 } 109 110 /*** 111 * @return javax.swing.JFrame 112 */ 113 public static JFrame getFrame() { 114 return moFrame; 115 } 116 117 /*** 118 * @param oArgs arguments to main 119 */ 120 public static void main(String[] oArgs) { 121 final JPUI oPrefGUI = new JPUI(); 122 JPUI.getFrame().pack(); 123 JPUI.getFrame().setVisible(true); 124 } 125 }

This page was automatically generated by Maven